package com.example.leetcode.trainingcamp.week12;

public class Test05_03 {

    public int reverseBits(int num) {
        int mask = 1;
        int cur = 0;
        int rever = 0;
        int max = 0;
        for (int i =0;i<32;i++){
            if ((num & mask) != 0){
                cur++;
                rever++;
            }else {
                rever = cur + 1;
                cur = 0;
            }
            if (rever > max){
                max = rever;
            }
            mask <<= 1;
        }
        return max;
    }

    public static void main(String[] args) {
        Test05_03 t = new Test05_03();
        System.out.println(t.reverseBits(0));
    }
}
